package hhm.wechat.test;

import com.alibaba.fastjson.JSONObject;

import hhm.wechat.pojo.menu.Button;
import hhm.wechat.pojo.menu.ClickButton;
import hhm.wechat.pojo.menu.Menu;
import hhm.wechat.pojo.menu.ViewButton;
import hhm.wechat.utils.WeixinUtil;

public class CreateMenu {

	public static void main(String[] args) {
		Menu menu = new Menu();
		ClickButton button11 = new ClickButton();
		button11.setName("click菜单");
		button11.setType("click");
		button11.setKey("11");

		ViewButton button21 = new ViewButton();
		button21.setName("view菜单");
		button21.setType("view");
		button21.setUrl("http://www.imooc.com");

		ClickButton button31 = new ClickButton();
		button31.setName("扫码事件");
		button31.setType("scancode_push");
		button31.setKey("31");

		ClickButton button32 = new ClickButton();
		button32.setName("地理位置");
		button32.setType("location_select");
		button32.setKey("32");

		Button button = new Button();
		button.setName("菜单");
		button.setSub_button(new Button[] { button31, button32 });

		menu.setButton(new Button[] { button11, button21, button });

		System.out.println(WeixinUtil.createMenu(
				"3b7P6MMDoSjgivqyGSt6LM5vzwnEc7Ab31Un7__CKXM01tmNUQfaskUVpO4cNJsUIYjEyHREVyKRPV9bWyAJyBdUjJ6yPJfSJM8pg1LkBIcVRa2Jh942_-XUCzL_N855IQUbAJALTX",
				JSONObject.toJSONString(menu)).toString());

	}

}
